/*************************************************************************
	> File Name: main.cc
	> Author: Joker
	> Mail: mahongtao@foxmail.com 
	> Created Time: 2020-09-23 11:54:24
 ************************************************************************/

#include "Memento.h"

#include <iostream>
using namespace std;

void test0(){
    Originator * pOriginator = new Originator("old state");
    pOriginator->PrintState();

    Memento * pMemento = pOriginator->CreateMemento();

    pOriginator->SetState("new state");
    pOriginator->PrintState();

    pOriginator->RestoreState(pMemento);
    pOriginator->PrintState();

    delete pOriginator;
    delete pMemento;
}
 
int main(int argc,char *argv[])
{
    test0();
    return 0;
}
